home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / bbs / fcfgw40s.zip / FILECFG.CPP < prev    next >
C/C++ Source or Header  |  1996-04-20  |  4KB  |  178 lines

  1. // FileCFG.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "FileCFG.h"
  6. #include "FileCFGDlg.h"
  7. #include "tipdlg.h"
  8. #include "SplashDlg.h"
  9. #include <dos.h>
  10. #include <direct.h>
  11.  
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CFileCFGApp
  20.  
  21. BEGIN_MESSAGE_MAP(CFileCFGApp, CWinApp)
  22.     ON_COMMAND(CG_IDS_TIPOFTHEDAY, ShowTipOfTheDay)
  23.     //{{AFX_MSG_MAP(CFileCFGApp)
  24.         // NOTE - the ClassWizard will add and remove mapping macros here.
  25.         //    DO NOT EDIT what you see in these blocks of generated code!
  26.     //}}AFX_MSG
  27.     ON_COMMAND(ID_HELP, CWinApp::OnHelp)
  28. END_MESSAGE_MAP()
  29.  
  30. /////////////////////////////////////////////////////////////////////////////
  31. // CFileCFGApp construction
  32.  
  33. CFileCFGApp::CFileCFGApp()
  34. {
  35.     // TODO: add construction code here,
  36.     // Place all significant initialization in InitInstance
  37. }
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // The one and only CFileCFGApp object
  41.  
  42. CFileCFGApp theApp;
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CFileCFGApp initialization
  46.  
  47. BOOL CFileCFGApp::InitInstance()
  48. {
  49.     CFileCFGDlg dlg;
  50.     m_pMainWnd = &dlg;
  51.  
  52.     // Standard initialization
  53.     // If you are not using these features and wish to reduce the size
  54.     //  of your final executable, you should remove from the following
  55.     //  the specific initialization routines you do not need.
  56.  
  57. #ifdef _AFXDLL
  58.     Enable3dControls();            // Call this when using MFC in a shared DLL
  59. #else
  60.     Enable3dControlsStatic();    // Call this when linking to MFC statically
  61. #endif
  62.  
  63.     int nResponse = dlg.DoModal();
  64.     if (nResponse == IDOK)
  65.     {
  66.         // TODO: Place code here to handle when the dialog is
  67.         //  dismissed with OK
  68.     }
  69.     else if (nResponse == IDCANCEL)
  70.     {
  71.         // TODO: Place code here to handle when the dialog is
  72.         //  dismissed with Cancel
  73.     }
  74.  
  75.     // Since the dialog has been closed, return FALSE so that we exit the
  76.     //  application, rather than start the application's message pump.
  77.     return FALSE;
  78. }
  79. /*
  80. BOOL CFileCFGDlg::PreTranslateMessage(MSG* pMsg)
  81. {
  82.     CSplashWnd::PreTranslateAppMessage(pMsg);
  83.     return CWinApp::PreTranslateMessage(pMsg);
  84. }
  85. */
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CAboutDlg dialog used for App About
  88.  
  89.  
  90. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  91. {
  92.     //{{AFX_DATA_INIT(CAboutDlg)
  93.     //}}AFX_DATA_INIT
  94. }
  95.  
  96. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  97. {
  98.     CDialog::DoDataExchange(pDX);
  99.     //{{AFX_DATA_MAP(CAboutDlg)
  100.     //}}AFX_DATA_MAP
  101. }
  102.  
  103. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  104.     //{{AFX_MSG_MAP(CAboutDlg)
  105.         // No message handlers
  106.     //}}AFX_MSG_MAP
  107. END_MESSAGE_MAP()
  108.  
  109.  
  110. BOOL CAboutDlg::OnInitDialog()
  111. {
  112.     // CG: Folowing code is added by System Info Component
  113.     {
  114.     CDialog::OnInitDialog();
  115. #ifndef _MAC
  116.     CString strFreeDiskSpace;
  117.     CString strFreeMemory;
  118.     CString strFmt;
  119.  
  120.     // Fill available memory
  121.     MEMORYSTATUS MemStat;
  122.     MemStat.dwLength = sizeof(MEMORYSTATUS);
  123.     GlobalMemoryStatus(&MemStat);
  124.     strFmt.LoadString(CG_IDS_PHYSICAL_MEM);
  125.     strFreeMemory.Format(strFmt, MemStat.dwTotalPhys / 1024L);
  126.     SetDlgItemText(IDC_STATIC_MEMORY, strFreeMemory);
  127.  
  128.     // Fill disk free information
  129.     struct _diskfree_t diskfree;
  130.     int nDrive = _getdrive(); // use current default drive
  131.     if (_getdiskfree(nDrive, &diskfree) == 0)
  132.     {
  133.         strFmt.LoadString(CG_IDS_DISK_SPACE);
  134.         strFreeDiskSpace.Format(strFmt,
  135.             (DWORD)diskfree.avail_clusters *
  136.             (DWORD)diskfree.sectors_per_cluster *
  137.             (DWORD)diskfree.bytes_per_sector / (DWORD)1024L,
  138.             nDrive-1 + _T('A'));
  139.     }
  140.      else
  141.          strFreeDiskSpace.LoadString(CG_IDS_DISK_SPACE_UNAVAIL);
  142.  
  143.     SetDlgItemText(IDC_STATIC_DISK_SPACE, strFreeDiskSpace);
  144. #endif //_MAC
  145.     }
  146.  
  147.     return TRUE;
  148. }
  149.  
  150. void CFileCFGApp::ShowTipAtStartup(void)
  151. {
  152.     CCommandLineInfo cmdInfo;
  153.     ParseCommandLine(cmdInfo);
  154.     if (cmdInfo.m_bShowSplash)
  155.     {
  156.         CTipDlg dlg;
  157.         if (dlg.m_bStartup)
  158.             dlg.DoModal();
  159.     }
  160.  
  161. }
  162.  
  163. void CFileCFGApp::ShowTipOfTheDay(void)
  164. {
  165.     CTipDlg dlg;
  166.     dlg.DoModal();
  167. }
  168.  
  169. void CFileCFGApp::ShowSplashScreen(void)
  170. {
  171.     CCommandLineInfo cmdInfo;
  172.     ParseCommandLine(cmdInfo);
  173.  
  174.     if( cmdInfo.m_bShowSplash ){
  175.         CSplashDlg dlg;
  176.         dlg.DoModal();
  177.     }
  178. }